package com.lhz.framework.config;

import org.apache.naming.factory.BeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

/**
 * Created by LiGezZ
 * Date on 2021/4/22 10:51
 * 全局Bean的配置
 *
 * @author LiGezZ
 */
@Configuration
@Order(1)
public class GlobalBeanConfig {

    @Bean
    public BeanFactory beanFactory() {
        return new BeanFactory();
    }

    @Bean
    public ThreadPoolTaskScheduler threadPoolTaskScheduler() {
        ThreadPoolTaskScheduler executor = new ThreadPoolTaskScheduler();
        //线程池大小
        executor.setPoolSize(20);
        executor.setWaitForTasksToCompleteOnShutdown(true);
        executor.setAwaitTerminationSeconds(60);
        return executor;
    }
}
